package com.example.user.controller;

import com.example.common.core.controller.BaseController;
import com.example.common.core.domain.R;
import com.example.common.core.domain.TableDataInfo;
import com.example.user.domain.announcement.dto.AnnouncementQueryDTO;
import com.example.user.domain.announcement.vo.AnnouncementDetailVO;
import com.example.user.service.IAnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/announcement")
public class AnnouncementController extends BaseController {

    @Autowired
    private IAnnouncementService announcementService;
    @GetMapping("/list")
    public TableDataInfo list(AnnouncementQueryDTO announcementQueryDTO) {
        return getTableDataInfo(announcementService.list(announcementQueryDTO));
    }
    //  /announcement/detail
    @GetMapping("/detail")
    public R<AnnouncementDetailVO> detail(Long announcementId) {
        return R.ok(announcementService.detail(announcementId));
    }

    @GetMapping("/preAnnouncement")
    public R<String> preAnnouncement(Long announcementId) {
        return R.ok(announcementService.preAnnouncement(announcementId));
    }
    @GetMapping("/nextAnnouncement")
    public R<String> nextAnnouncement(Long announcementId) {
        return R.ok(announcementService.nextAnnouncement(announcementId));

    }
}
